<?php

require_once 'C:\xampp\htdocs/symfony-1.2.7/lib/autoload/sfCoreAutoload.class.php';
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'../lib/lib/MediaConfiguration.class.php';
sfCoreAutoload::register();

class ProjectConfiguration extends sfProjectConfiguration
{
  const FPDF_VERSION               = 1.53;
  const SHELL_LOCALE               = 'en_US.utf8';
  const VERSION                    = 'Beta 3.0.2';
  public function setup()
  {
    // for compatibility / remove and enable only the plugins you want
    //$this->enableAllPluginsExcept(array('sfDoctrinePlugin', 'sfCompat10Plugin'));
    
    $this->enableAllPluginsExcept(array('sfPropelPlugin', 'sfCompat10Plugin'));
    
    $options = array('baseClassName' => 'kcDoctrineRecord');
    sfConfig::set('doctrine_model_builder_options', $options);
    
    //$this->dispatcher->connect('actions.send_email', array('kcEmail', 'instantiateAndSend'));
    
    MediaConfiguration::setup();
    
    sfWidgetFormSchema::setDefaultFormFormatterName('ext');
    

    $this->setConfigVariables();
  }
  
  protected function setConfigVariables()
  {
    sfConfig::set('site_name', 'SaludOnline');
    
    $this->setConfigDirPathVariable('web'                       , sfConfig::get('sf_web_dir')   .DIRECTORY_SEPARATOR, 'sf'                                                   );    
    $this->setConfigDirPathVariable('images'                    , sfConfig::get('sf_web_dir')   .DIRECTORY_SEPARATOR.'images'                                          , 'sf');
    $this->setConfigDirPathVariable('cuerpo_humano_images'      , sfConfig::get('sf_upload_dir').DIRECTORY_SEPARATOR.'cuerpo_humano_images'                                  );
    $this->setConfigDirPathVariable('cuerpo_humano_thumb_images', sfConfig::get('sf_upload_dir').DIRECTORY_SEPARATOR.'cuerpo_humano_images'.DIRECTORY_SEPARATOR.'thumb'      );
    $this->setConfigDirPathVariable('paciente_images'           , sfConfig::get('sf_upload_dir').DIRECTORY_SEPARATOR.'paciente_images'                                  );
    $this->setConfigDirPathVariable('paciente_thumb_images'     , sfConfig::get('sf_upload_dir').DIRECTORY_SEPARATOR.'paciente_images'.DIRECTORY_SEPARATOR.'thumb'      );
    
  }
  
  protected function setConfigDirPathVariable($name, $dir, $prefix = 'app')
  {
    sfConfig::set(sprintf('%s_%s_dir'     , $prefix, $name), $dir);
    sfConfig::set(sprintf('%s_%s_path'    , $prefix, $name), str_replace('\\', '/', substr($dir, strpos($dir, $this->getProjectName()) - 1)));
    sfConfig::set(sprintf('%s_%s_dir_name', $prefix, $name), substr($dir, strrpos($dir, DIRECTORY_SEPARATOR) + 1));
  }
  
  public function getProjectName()
  {
    return substr($this->getRootDir(), strrpos($this->getRootDir(), DIRECTORY_SEPARATOR) + 1);
  }
}
